use std::collections::HashSet;

pub fn set_to_option_strings(params: Option<HashSet<String>>) -> Option<String> {
    match params {
        None => {None}
        Some(params) => {
            Some(params.into_iter().map(|param| {param}).collect::<Vec<String>>().join(","))
        }
    }
}

pub fn set_to_option_str(params: Option<&HashSet<String>>) -> Option<String> {
    match params {
        None => {None}
        Some(params) => {
            Some(params.into_iter().map(|param| {param.to_string()}).collect::<Vec<String>>().join(","))
        }
    }
}

pub fn option_string_to_set(params: &Option<String>) -> Option<HashSet<String>> {
    match params {
        None => {None}
        Some(value) => {
            Some(value.split(",").collect::<Vec<&str>>().into_iter().map(|param| {param.to_string()}).collect::<HashSet<String>>())
        }
    }
}


pub struct Adder {
    idx: i32,
}

impl Adder {
    pub fn new() -> Adder {
        Adder { idx: -1 }
    }

    pub fn add(&mut self)->i32 {
       self.idx += 1;
       self.idx
    }
}